import pandas as pd
import numpy as np
Hygiene2018 = pd.read_csv(r"C:\Users\aniksrukkie\Documents\stats.csv")
Hygiene2018.head()
| No | states | Household members | percentage of hygiene service users | |
|---|---|---|---|---|
| 0 | 32 | Abia | 3814312 | 10.2 |
| 1 | 3 | ADAMAWA | 4343611 | 10.1 |
| 2 | 7 | AKWA IBOM | 5363762 | 10.3 |
| 3 | 11 | ANAMBRA | 5651329 | 14.6 |
| 4 | 8 | BAUCHI | 6721471 | 1.7 |
import plotly
import plotly.io as pio
import plotly.express as px
import plotly.graph_objs as go
fig=px.bar(Hygiene2018,y="percentage of hygiene service users", x="states")
fig.show()
import json
with open (r"C:\Users\aniksrukkie\Documents\mfm.geojson") as f:
HYGIENE = json.load(f)
state_id_map={}
for feature in HYGIENE['features']:
feature['id']= feature['properties']['OBJECTID']
state_id_map[feature['properties']['OBJECTID']]=feature['id']
nigeria_coordinates = {"lat":9.0820,"lon":8.6753}
fig = px.choropleth_mapbox(
Hygiene2018,
geojson = HYGIENE,
locations = "No",
color = "percentage of hygiene service users",
center = nigeria_coordinates,
zoom = 5,
opacity = 0.5,
hover_name = "states",
color_continuous_scale= "earth",
mapbox_style = "carto-positron",
labels = {"No":"percentage of hygiene service users"}
)
fig.show()
pip install geojson
Collecting geojsonNote: you may need to restart the kernel to use updated packages. Downloading geojson-2.5.0-py2.py3-none-any.whl (14 kB) Installing collected packages: geojson Successfully installed geojson-2.5.0